package window;

import burp.*;
import javax.swing.*;
import java.awt.*;

public class MainTab implements ITab {
    private IExtensionHelpers helpers;

    // number
    public static int number = 1;

    // numberPanel
    public static JTabbedPane numPanel;

    // burp callback
    private IBurpExtenderCallbacks callbacks;

    @Override
    public String getTabCaption() {
        return "Extloader";
    }

    @Override
    public Component getUiComponent() {
        return numPanel;
    }

    public MainTab(IBurpExtenderCallbacks iBurpExtenderCallbacks) {
        this.helpers = iBurpExtenderCallbacks.getHelpers();
        callbacks = iBurpExtenderCallbacks;
        SwingUtilities.invokeLater(new PanelRunnable());
    }

    class PanelRunnable implements Runnable {
        /**
         * 初始化变量
         */
        public PanelRunnable() {
            numPanel = new JTabbedPane();
            numPanel.setVisible(true);
        }

        /**
         * MainTab布局
         */
        @Override
        public void run() {
            // 将MainTab加入Extloder扩展主页面
            callbacks.customizeUiComponent(numPanel);
            callbacks.addSuiteTab(MainTab.this);
        }
    }
}